home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung / Power-Programmierung (Tewi)(1994).iso / magazine / progjour / 1991 / 06 / alib / put_uns.asm < prev    next >
Assembly Source File  |  1991-08-21  |  463b  |  35 lines

  1.     title    put_unsigned
  2.     include    asm.inc
  3.  
  4.     public    put_unsigned
  5.  
  6.     .code
  7.     extn    putchar
  8.  
  9. ;;    put unsigned
  10. ;
  11. ;    entry    AX    number
  12. ;    uses    AX
  13. ;
  14. put_unsigned proc
  15.     pushm    cx,dx
  16.     mov    cx,10
  17.     mov    dx,-1            ; push sentinal
  18. pus1:    push    dx
  19.     mov    dx,0
  20.     div    cx            ; divide digits
  21.     cmp    ax,0
  22.     jne    pus1
  23.     inc    dx
  24. pus2:    xchg    ax,dx            ; write digits
  25.     add    al,'0'-1
  26.     call    putchar
  27.     pop    dx
  28.     inc    dx
  29.     jnz    pus2            ;  if not sentinal
  30.     popm    dx,cx
  31.     ret
  32. put_unsigned endp
  33.  
  34.     end
  35.